20/01/2021

What is R Markdown?

  • Save and execute code
  • Flexible compartmentalized work flow
  • Document your work
  • Lab book for your code
  • Turn your analyses into documents
  • Self contained replication friendly output
  • Use multiple languages (R, Python, SQL) in a single .rmd

Set up

install.packages('rmarkdown')

Set up

Set up

Set up

  • Can use R Markdown outside of R Studio
# Render the default (first) format defined in the file
render("input.Rmd")

# Render multiple formats
render("input.Rmd", c("html_document", "pdf_document"))

What is R Markdown?

.rmd is similar to a R script, but it is better..

What is R Markdown?

.rmd is similar to a R script, but it is better..

What is R Markdown?

Knit document, lots of output formats

Executes and displays code and/or outputs

No export/insert required

plot(pressure)

Executes and displays code and/or outputs

Lots of output formats

  • html_document
  • pdf_document
  • word_document
  • odt_document
  • rtf_document
  • isoslides_presentation
  • slidy_presentation
  • powerpoint_presentation
  • shiny_document
  • shiny_slides

Visual R Markdown

https://rstudio.github.io/visual-markdown-editing/#/

  • R Studio 1.4 (20210119)
  • Zotero Integration
  • Real time Spell Checking
  • Rich Keyboard Support

Multilingual

Why use HTML?

Why use HTML?

  • Compatible for anyone using a web browser
  • Light weight small files sizes
  • Responsive, scales to the width of the window
  • Can add some useful features;

Checkbox

Drop Down Menu - Spare notes can go in here

Why use HTML?

Interactive Outputs

Code

LEC <- leaflet() %>%
  addProviderTiles("Stamen.Watercolor") %>%  
  addMarkers(lng=-2.7869553637288207, lat=54.009157481709096, popup="Lancaster Environment Centre")

Why use HTML?

Interactive Outputs

http://www.rebeccabarter.com/blog/2017-04-20-interactive/

Why use HTML?

Interactive Tables

Why use HTML?

Fully self contained reproducable file

Why use HTML?

Fully self contained reproducable file

Why use HTML?

  • Demo
  • Mention Bookdown